﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using GameStudio.Common;
using System.Reflection;

namespace GameStudio.Common
{
    public static class Session
    {
        public static Project CurrentProject { get; set; }
        
        static Session()
        {
            CurrentProject = new Project();
            CurrentProject.Setting.Version = "Game Studio 0.1";
        }

        //public void AddFile(FileItem CurrentFile)
        //{
        //    CurrentProject.items.Add(CurrentFile);
        //}

        public static List<Type> GetTypes()
        {

            List<Type> types = new List<Type>();

            Assembly asm = typeof(Project).Assembly;

            Type _Item = typeof(Items);

            //Query our types. We could also load any other assemblies and
            //query them for any types that inherit from Items

            foreach (Type currType in asm.GetTypes())
            {
                if (!currType.IsAbstract
                    && !currType.IsInterface
                    && _Item.IsAssignableFrom(currType))

                    types.Add(currType);
            }

            return types;
        }
      
        public static void AddItem(Items newItem)
        {
            CurrentProject.items.Add(newItem);
        }

        public static void DeleteItem(Items item)
        {
            CurrentProject.items.Remove(item);
        }
    }
}
